package com.atguigu.gmall.item.rpc.controller;

import com.atguigu.gmall.item.service.ItemService;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/inner")
public class ItemController {

    @Autowired
    ItemService itemService;


    /**
     * 查询商品详情
     * @param skuId
     * @return
     */
    @GetMapping("/sku/detail/{skuId}")
    Map<String, Object> itemDetail(@PathVariable("skuId") Long skuId) throws JsonProcessingException {
        //1、查询sku的详情数据
        Map<String,Object> detail = itemService.getItemDetail(skuId);
        return detail;
    }



}
